<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link href="css/style1.css" rel="stylesheet" type="text/css" />
<link href="/css/common.css?v7.2" type="text/css" rel="stylesheet" />
<link href="/css/public.css?v1" type="text/css" rel="stylesheet" />
<link type="image/x-icon" rel="icon" mce_href="/images/favicon.ico"
	href="/images/favicon.ico?v=0.1" />
<link rel="stylesheet" href="/dist/APlayer.min.css">
<link type="image/x-icon" rel="shortcut icon"
	mce_href="/images/favicon.ico" href="/images/favicon.ico?v=0.1" />
<script type="text/javascript" src="/js/jquery-3.3.1.min.js"></script>
<script src="/js/hm.js?ed37722b76c3b14891aee449d10db2b1"></script>
<script src="/js/jq.js?v4.1" type="text/javascript"></script>
<script src="/js/ss.js?v4.8" type="text/javascript"></script>
<script type="text/javascript" src="/js/jquery-3.3.1.min.js"></script>

</head>

<body>

	<div class="place">
    <span>位置：</span>
    <ul class="placeul">
    <li><a href="#">首页</a></li>
    <li><a href="#">表单</a></li>
    </ul>
    </div>
    
    <div class="formbody">
    
    <div class="formtitle"><span>基本信息</span></div>
    <form id="uploadForm"  enctype="multipart/form-data" method="post">
    <ul class="forminfo">
    <li><label>作者</label><input name="mname" type="text" class="dfinput"  id="mname"/><i></i><span style="color: red;" id="imname"></span></li>
    <li><label>歌曲名</label><input name="mtitle" type="text" class="dfinput"  id="mtitle"/><i></i><span style="color: red;"  id="imtitle"></span></li>
    <li><label>是否上架</label><cite><input name="mAid" type="radio" value="1" checked="checked" />是&nbsp;&nbsp;&nbsp;&nbsp;<input name="mAid" type="radio" value="0" />否</cite></li>
    <li><label>歌曲海报</label><input name="files" type="file" class="dfinput"  id="mimg"/><span style="color: red;" id="imimg"></span></li>
    <li><label>歌词</label><input name="files" type="file" class="dfinput"  id="mdesc"/><span style="color: red;" id="imdesc"></span></li>
    <li><label>歌曲</label><input name="files" type="file" class="dfinput"  id="murl"/><span style="color: red;" id="imurl"></span></li>
    <li><label>&nbsp;</label><input  id="submit" type="button" class="btn" value="确认上传"/></li>
    </ul>
    </form>
    
    </div>
    
    <script type="text/javascript">
			$('#submit').click(function() {
				var mname=document.getElementById("mname");
				var mtitle=document.getElementById("mtitle");
				var mimg=document.getElementById("mimg");
				var mdesc=document.getElementById("mdesc");
				var murl=document.getElementById("murl");
				if(mname.value==null||mname.value==""){
					$("#imname").append('             用户名不能为空');
					return;
				}
				if(mtitle.value==null||mtitle.value==""){
					$("#imtitle").append('             歌曲名不能为空');
					return;
				}
				if(mimg.value==null||mimg.value==""){
					$("#imimg").append('             海报不能为空');
					return;
				}
				if(mdesc.value==null||mdesc.value==""){
					$("#imdesc").append('             歌词不能为空');
					return;
				}
				if(murl.value==null||murl.value==""){
					$("#imurl").append('             音频不能为空');
					return;
				}
				var formData = new FormData($('#uploadForm')[0]);
				$.ajax({
					type : 'POST',
					url : 'uploadMusic',
					data : formData,
					cache : false,
					processData : false,
					contentType : false,
					async:false,
	 				success: function(message) {
	 					W.tips("上传成功");
					}
				});
			})
</script>
</body>
</html>
